#ifndef LAYERED_DISPLAY_OBJECT_CONTAINER
#define LAYERED_DISPLAY_OBJECT_CONTAINER

#include <set>
#include <SDL/SDL.h>

#include "../utils/useful_macros.h"
#include "DisplayObject.h"

class LayeredLayeredDisplayObjectContainer : public DisplayObject
{
    public:
        
        LayeredDisplayObjectContainer(Uint8 layers);
        
        ~LayeredDisplayObjectContainer();
        
        /* Adds a drawable object to the given layer
         * where it will be rendered every frame
         * returns 1 on succes, and -1 on error,
         * printing the error message*/
        
        int Add(DisplayObject* object, Uint8 layer);
        
        /* Removes a drawable object from the given layer
         * returns 1 on succes, and -1 on error,
         * printing the error message*/
        
        int Remove(DisplayObject* object, Uint8 layer);
        
        /* This function is called to render a frame of the game screen
         * to a given surface */
        
        virtual void Render(SDL_Surface* surface);
        
    private:
        
        Uint8 _layers;
        
        /* the lists of objects, one for each layer */
        
        std::set<DisplayObject*>* _objects;
        
};

#endif
